perm filename MONMON[J17,SYS] blob
sn#026132 filedate 1973-02-28 generic text, type T, neo UTF8
COMMENT ⊗ VALID 00025 PAGES
RECORD PAGE DESCRIPTION
00001 00001
00004 00002 TITLE MONMON - NEW MONITOR MONITOR.
00008 00003 SUBTTL STORAGE OF SORTS
00014 00004 SUBTTL ERROR MESSAGES.
00015 00005 SUBTTL HERE WE LOCATE THE SYSTEM SYMBOL TABLE
00017 00006 SUBTTL THERE ARE NO SYMBOLS IN SYSTEM CORE - READ SWAPPING DISK.
00020 00007 SUBTTL SYMBOL TABLE STUFF
00024 00008 SUBTTL SEGMENT MANAGER
00026 00009 SUBTTL UNDEF - ERROR MESSAGE FOR UNDEFINED SYMBOLS.
00027 00010 SUBTTL BEGIN HERE
00031 00011 SUBTTL MAIN COMMAND SCANNER.
00036 00012 SUBTTL GETSIX
00038 00013 SUBTTL PUT UP A TITLE LINE.
00041 00014 SUBTTL SWPINI & SPWMOD SPACEWAR JOB
00045 00015 SUBTTL PROCESS "CLOCK" REQUESTS
00046 00016 SUBTTL DCHR CHARACTER-BY-CHARACTER DISPLAY
00047 00017 SUBTTL HMSTIME HOURS-MINUTES-SECONDS TIME.
00049 00018 SUBTTL DDATE
00050 00019 SUBTTL DPYTAB
00054 00020 SUBTTL MAP DISPLAY A CORE MAP
00058 00021 SUBTTL THE LITTLE MAN INSIDE?
00061 00022 DEFINE FOO(X,Y,III)
00066 00023 SUBTTL MDRAW DRAW THE MAP
00073 00024 SUBTTL DSIXB SIXBIT OUTPUT ROUTINE
00076 00025 END BEGIN
00077 ENDMK
⊗;
TITLE MONMON - NEW MONITOR MONITOR.
SUBTTL REG 2 MAY 72.
; DEFINITIONS
A←1
B←2
C←3
D←4
W←5
X←6
Y←7
Z←10
K←11
L←12
M←13
N←14
R←15
SPDL←16 ;SPECIAL PDL
P←17 ;NORMAL PDL
; OPDEFS
OPDEF UPGIOT [703B8]
OPDEF RESET [CALLI]
OPDEF CORE [CALLI 11]
OPDEF EXIT [CALLI 12]
OPDEF DATE [CALLI 14]
OPDEF TIMER [CALLI 22]
OPDEF PEEK [CALLI 33]
OPDEF SLEEP [CALLI 31]
OPDEF REMAP [CALLI 37]
OPDEF SETPR2 [CALLI 400052]
OPDEF CORE2 [CALLI 400015]
OPDEF DETSEG [CALLI 400017]
OPDEF LINKUP [CALLI 400023]
OPDEF SPCWGO [CALLI 400003]
OPDEF SSW [043000,,636367] ;STOP SPACEWAR.
OPDEF DISMIS [CALLI 400024] ;UUO TO DISMISS SPACEWAR.
OPDEF DPYCLR [701B8] ;NORMALIZE DPY
OPDEF PPIOT [702B8] ;PAGE PRINTER OPERATIONS
OPDEF PPSEL [PPIOT] ;SELECT PIECE OF PAPER.
OPDEF PPACT [PPIOT 1,] ;EA = BIT MAP PP0=18, PP1=19, ENABLE PP
OPDEF DPYPOS [PPIOT 2,] ;SET FIRST LINE Y POSITION TO EA +/- 1000
OPDEF DPYSIZ [PPIOT 3,] ;X*1000+Y
OPDEF PGIOT [715B8] ;PEICE OF GLASS
VBRT←←4000 ;LVW BRIGHTNESS FIELD
VSIZ←←1000 ;LVW SIZE FIELD
VABS←←100 ;LVW ABSOLUTE FIELD
VENDP←←20 ;LVW ENDPOINT FIELD
VINVIS←←40 ;LVW INVISIBLE FIELD
DEFINE LVW(X,Y,TYPE,MODE,BRT,SIZ)<
IFIDN <MODE><a>,<MD←←1;>MD←←0
IFIDN <TYPE><i>,<TT←←2;>TT←←0
IFIDN <BRT><>,<BQ←←0;>BQ←←BRT
IFIDN <SIZ><>,<SQ←←0;>SQ←←SIZ
BYTE(11)<X>,<Y>(3)BQ,SQ(2)MD,TT(4)6
>
COMMENT/
A LONG VECTOR WORD (LVW) FOR THE III DISPLAY HAS THE FOLLOWING FORMAT
BITS 0-10 X COORDINATE
BITS 11-21 Y COORDINATE
BITS 22-24 BRT BRIGHTNESS. 0=NO CHANGE, 1-7 INCREASING BRIGHTNESS
BITS 25-27 SIZ SIZE. 0=NO CHANGE, 1-7 INCREASING BRIGHTNESS
BIT 29 M MODE. 0=RELATIVE TO LAST, 1=ABSOLUTE FROM CENTER
BITS 30-31 T TYPE. 0=VISIBLE, 1=ENDPOINT, 2=INVISIBLE
BITS 32-35 6. DENOTES LVW IN DISPLAY PROCESSOR
/
EXTERN JOBFF,JOBREL
SWTICK←←6 ;NUMBER OF TICKS BETWEEN ACTIVATIONS.
SWPSEC←←74/SWTICK ;NUMBER OF ACTIVATIONS PER SECOND.
SUBTTL STORAGE OF SORTS
PDLEN←←40
PDLIST: BLOCK PDLEN
SPDLEN←←40
SPWPDL: BLOCK SPDLEN ;PDL FOR SPACEWAR.
PATCH: BLOCK 20
PATCH1: BLOCK 20
PATCH2: BLOCK 20
WCMA: BLOCK 3
JOBN←←100
XJOB: 0 ;CURRENT JOB
XFIT: 0
XFORCE: 0
XSHFWA: 0
XQUEUE: BLOCK JOBN ;JOBQUE
XNAME: BLOCK JOBN ;JOBNAM
XPPN: BLOCK JOBN ;PRJPRG
XADR: BLOCK JOBN ;JBTADR
XCORTB: BLOCK 100 ;CORTAB
XLINE: BLOCK JOBN ;JBTLIN
XSTS: BLOCK JOBN ;JBTSTS
XSWP: BLOCK JOBN ;JBTSWP
XTIME: BLOCK JOBN ;TTIME
XSWPG: BLOCK JOBN ;SPWGO
XSWPG2: BLOCK JOBN ;SP2GO
XJBST2: BLOCK JOBN ;JBTST2
MAPTXT: BLOCK JOBN*4 ;KEEP TEXT FOR THE MAP HERE!
MPHILO: BLOCK 106 ;KEEP HI/LO LOCATION OF JOB HERE
MPYLOC: BLOCK 106 ;KEEP Y POSITION OF BOUND LINE/DATA LINE
MAPPPN: BLOCK JOBN ;KEEP PPN FOR MAP HERE
MAPNAM: BLOCK JOBN ;KEEP JOBNAME FOR MAP HERE
XQNAM: BLOCK 20 ;QUEUE NAMES
SYMMAX←←1000 ;MAXIMUM NUMBER OF SYMBOLS.
INSYM: BLOCK SYMMAX ;SIXBIT TABLE OF INTERNALIZED SYMBOLS
INVAL: BLOCK SYMMAX ;INTERNAL TABLE OF SYMBOLS&VALUES
INSCNT: 0 ;COUNT OF ACTUAL INTERNALIZED SYMBOLS.
SPWACT: 0 ;SET TO -1 ONCE SPACEWAR STARTS
SPWSUS: 0 ;SET TO -1 TO MAKE SPACEWAR DISMISS QUICK
SPWACK: 0 ;SET BY SPACEWAR TO ACKNOWLEDGE A SUSPESION REQUEST
UPTIM: 0 ;SAVE UPTIME HERE.
TCNT: 0
TBYP: 0
TWORD: 0
DIGCNT: 0
DEBUG: 0 ;SET ≠0 FOR NO SPACEWAR
STHERE: 0 ;SET TO -1 WHEN ATTACHED TO SYMBOLS.
ZERO: 0 ;A CELL CONTAINING ZERO
PROREL: 0 ;SET TO LAST VALUE OF SETPR2
XCONFI: BLOCK 20 ;ASCIZ TEXT COPIED FROM SYSTEM.
UPTXT: 0 ;UPTIME TEXT
SYSREL: 0
CLOCK: 0 ;BYTE POINTER TO MAKE CLOCK REQUESTS.
CLKTAB: BLOCK 200 ;TABLE FOR CLOCK REQUESTS.
DPTR0: 0 ;POINTER/COUNTER FOR BUFFER0
DPTR1: 0
DPTR2: 0
DPTR3: 0
DPTR4: 0
DPTR5: 0
DPBLN0←←40
DPBLN1←←40
DPBLN2←←400
DPBLN3←←400
DPBLN4←←2000
DPBLN5←←20
DPYBF0: BLOCK DPBLN0
DPYBF1: BLOCK DPBLN1
DPYBF2: BLOCK DPBLN2
DPYBF3: BLOCK DPBLN3
DPYBF4: BLOCK DPBLN4
DPYBF5: BLOCK DPBLN5
DPYHD0: BLOCK 2
DPYHD1: BLOCK 2
DPYHD2: BLOCK 2
DPYHD3: BLOCK 2
DPYHD4: BLOCK 2
DPYHD5: BLOCK 2
SSYMS: ;LIST OF VALUES OF SYMBOLS OF SPECIAL INTEREST.
AQNAMS: 0
AJOBNA: 0
AJTSTS: 0
APRJPR: 0
AJBST2: 0
AJBTQ: 0
AJQUE: 0
AJOB: 0
ACORTA: 0
AJLIN: 0
AJADR: 0
AJSWP: 0
ATTIME: 0
ASPWGO: 0
ASP2GO: 0
AUPTI: 0
ACONFI: 0
ATIME: 0
ATDATE: 0
AFORCE: 0
AFIT: 0
ASHFWA: 0
VMXQUE: 0
SSYMND←←.-1
MAPON: 0 ;SET TO -1 WHILE MAP IS ACTIVE
MAPOFF: 0 ;SET TO -1 TO KILL MAP.
THSJOB: 0
HILOC: 0
LOLOC: 0
CORSIZ: 0 ;SET TO NUMBER OF 1K BLOCKS OF CORE.
THJDR: 0
UFL: 0 ;SET TO -1 WHEN UNDEFINED SYMBOL IS USED
WHATFL: 0 ;SET TO -1 FOR UNKNOWN COMMAND
XON: 0 ;SET TO -1 DURING X COMMAND
ACTIVE: 0
TCODE: 0
TNAME: 0
QLN←←200 ;SIZE OF QUEUE SPACE.
QSPACE: BLOCK QLN ;SPACE TO PUT QBLOCKS.
QPTR: 0 ;AMOUNT OF SPACE USED IN QUEUE.
TBLON: 0 ;SET TO -1 WHILE DISPLAYING TABLES, ETC.
NJACT: 0
FILCHR: 0 ;FILL CHARACTER FOR DECIMAL PRINTER.
LASTHI: 0 ;HIGHEST ADDRESS IN USE BY USERS
BODNOW: 0 ;SET TO -1 WHEN WE MOVE THE LITTLE MAN.
DPZERO: DPZERO+1 ;USED FOR KILLING A PIECE OF GLASS
0
BLOCK 2 ;MAKE SURE THAT NOTHING HAPPENS
MANLOC: 0
HOLSEN: 0
NJT←←10 ;NUMBER OF TABLES TO REMEMBER DISPLAY DATA
JTAB: BLOCK NJT*JOBN ;SAVE JOB DATA HERE.
WPJ←←20 ;NUMBER OF WORDS TO USE FOR EACH JOB LINE.
LTEXT: BLOCK 20*JOBN ;SOME WORDS FOR EACH JOB. TO DISPLAY LINES.
SUBTTL ERROR MESSAGES.
NOCORE: OUTSTR [ASCIZ/CORE UUO FAILURE.
/]
JRST ESTOP
NOSYM: OUTSTR [ASCIZ/NO SYMBOLS CAN BE FOUND ANYWHERE.
/]
JRST ESTOP
FBERR: OUTSTR [ASCIZ/FAST BAND READ ERROR.
/]
JRST ESTOP
NOREMA: OUTSTR [ASCIZ/REMAP FAILURE.
/]
JRST ESTOP
NOSETP: OUTSTR [ASCIZ/SETPR2 UUO FAILURE.
/]
JRST ESTOP
NOLINK: OUTSTR [ASCIZ/LINKUP FAILURE.
/]
JRST ESTOP
ESTOP: HALT
SUBTTL HERE WE LOCATE THE SYSTEM SYMBOL TABLE
GETSYM: MOVEI A,36 ;HERE'S WHERE THEY GOTTA BE.
PEEK A,
JUMPE A,SYMDSK ;JUMP IF SYMBOLS ARE ON THE DISK.
HLRE B,A ;THIS IS THE SIZE OF THE SYMBOL TABLE.
MOVN B,B ;MAKE IT POSITIVE.
MOVE D,B ;REMEMBER SIZE OF SYMBOLS
ADD B,JOBREL ;THIS IS HOW MUCH CORE WE NEED.
MOVEI W,1(B) ;SAVE END ADDRESS FOR BLT IN W.
HRRZ C,JOBREL ;GET THE DESTINATION-1 OF BLT
ADDI C,2 ;DESTINATION (2ND WORD IN NEXT K)
HRLI C,400000(A) ;SOURCE IN THE UPPER.
CORE B, ;ASK FOR CORE.
JRST NOCORE ;CAN'T HAVE ANY. LOSE.
MOVEM D,-1(C) ;SAVE SYMBOL TABLE SIZE IN FIRST WORD.
MOVEI D,-2(C) ;REMEMBER BREAK POINT FOR REMAP.
MOVEI B,37 ;LOOK FOR SYSTEM JOBREL
PEEK B,
CAILE B,377777 ;MORE THAN 128K OF CORE?
MOVEI B,377777 ;YES. REDUCE FOR SETPR2
TRZ B,1777
MOVSI B,1(B) ;WE WANT TO SPY INTO THE LOW HALF OF CORE.
SETPR2 B, ;TELL SYSTEM.
JRST NOSETP ;CAN'T DO THIS?
BLT C,(W) ;MOVE SYMBOL TABLE INTO CORE.
REMAP D, ;MAKE UPPER SEGMENT HAPPEN.
JRST NOREMA ;REMAP FAILURE.
POPJ P, ;RETURN WITH HAPPINESS.
SUBTTL THERE ARE NO SYMBOLS IN SYSTEM CORE - READ SWAPPING DISK.
SYMDSK: MOVE B,JOBFF
MOVEI A,42(B) ;GET SOME ROOM FOR ONE SECTOR.
CORE A,
JRST NOCORE
MOVEI A,400100 ;ABSOLUTE OPERATION ON SYSTEM BAND
MOVEM B,WCMA ;ADDRESS TO PUT DATA
MOVEI C,40 ;WORD COUNT
MOVEM C,WCMA+1 ;SAVE IT.
SETZM WCMA+2 ;SECTOR ZERO (WORDS 0-37)
FBREAD A,WCMA ;READ SWAPPING DISK.
JRST FBERR ;CAN'T WIN THIS WAY.
SKIPN C,36(B) ;PICKUP IMAGE OF SYSTEM LOCATION 36.
JRST NOSYM ;NO SYMBOLS ON THE SWAPPING DISK TOO.
MOVEI D,(C) ;SYSTEM'S SYMBOLS ADDRESS
LSH D,-5 ;DIVIDE TO MAKE A SECTOR NUMBER.
MOVEM D,WCMA+2 ;SAVE SECTOR NUMBER.
HLRE D,C ;GET -WD COUNT OF SYMBOL TABLE.
MOVN D,D
MOVE X,D ;SAVE SIZE HERE.
ADDI D,40 ;MAKE SURE WE READ ENOUGH.
MOVEM D,WCMA+1 ;SAVE WORD COUNT.
MOVE W,JOBREL ;REMEMBER THIS FOR REMAP LATER.
ADDI D,2(W) ;READ INTO SECOND WORD ABOVE OUR TOP.
CORE D, ;
JRST NOCORE ;CANT HAVE MORE CORE.
HLRE D,C ;GET THE WORD COUNT AGAIN
MOVNM D,1(W) ;SAVE IN FIRST WORD OF CORE IMAGE
MOVEI D,2(W) ;STARTING ADDRESS OF TRANSFER.
MOVEM D,WCMA ;SAVE IT.
FBREAD A,WCMA ;READ LIBRASCOPE.
JRST FBERR ;LOSE.
ANDI C,37 ;THIS IS THE SYMBOL TABLE OFFSET.
JUMPE C,DSYM1 ;NO OFFSET. WHAT A WIN.
ADDI C,2(W) ;THIS IS WHERE DATA STARTS
MOVS C,C
HRRI C,2(W) ;LOAD DESTINATION.
ADDI X,2(W) ;GET THE END OF THE BLT.
BLT C,(X) ;BLT THE SYMBOLS DOWN.
DSYM1: MOVE A,W ;GET THE ADDRESS FOR REMAP.
REMAP A,
JRST NOREMA ;LOSE.
POPJ P, ;RETURN.
SUBTTL SYMBOL TABLE STUFF
GETDEF: SKIPN SPWACT ;SKIP IF SPACEWAR IS IN PROGRESS.
JRST GETDF1 ;NO SPACEWAR TO LOSE.
SETOM SPWSUS ;SET SUSPENSION REQUEST.
GETDF0: SKIPE SPWACK ;SKIP IF NOT ACKNOWLEGE YET
JRST GETDFX ;OK. SPACEWAR IS DONE AND GONE.
MOVEI B,0
SLEEP B,
JRST GETDF0 ;LOOP.
GETDFX: PUSHJ P,GETDF1 ;CALL FOR SYMBOL
SOS (P) ;SO WE'LL NOT SKIP RETURN BY CPOPJ1
PUSH P,A
PUSHJ P,ATTOLD ;REATTACH WHATEVER WAS ATTACHED BEFORE.
POP P,A ;SAVE A OVER CALL ON ATTOLD!
SETZM SPWSUS ;RELEASE SPACEWAR SUSPENSION.
CPOPJ1: AOS (P)
CPOPJ: POPJ P,
GETDF1: PUSHJ P,SEGATT ;ATTACH TO SEGMENT, IF NOT ALREADY ATTACHED.
PUSHJ P,X6TO5 ;SIXBIT ARG IN A. RADIX 50 BACK IN B.
MOVE C,400000 ;GET THE SYMBOL TABLE LENGTH
ADDI C,377777 ;LOCATION OF LAST SYMBOL IN CORE.
GETDF2: MOVE D,(C) ;GET SYMBOL IN RADIX50
TLZ D,740000 ;AND OUT HIGH 4 BITS.
CAMN D,B ;COMPARE.
JRST GETDF3 ;SAME. WIN.
SUBI C,2
CAILE C,400000
JRST GETDF2
POPJ P, ;CAN'T FIND SYMBOL
GETDF3: MOVE B,1(C)
JRST CPOPJ1 ;RETURN A WINNER.
X6TO5: SETZB B,C ;SIXBIT IN A, RADIX50 COMES BACK IN B.
MOVE D,A ;GET THE SIXBIT.
X6TO5A: JUMPE D,CPOPJ ;IF ALL DONE, RETURN
LSHC C,6 ;MOVE ONE LETTER TO C.
JUMPE C,X6TO5E ;BLANK?
CAIL C,'0'
CAILE C,'9'
JRST X6TO5B ;NOT A DIGIT
SUBI C,'0'-1 ;MAP '0' ← 1 '9' ← 12
JRST X6TO5E
X6TO5B: CAIL C,'A'
CAILE C,'Z'
JRST X6TO5C
SUBI C,'A'-13 ;'A' ← 13
JRST X6TO5E
X6TO5C: ADDI C,42
CAIN C,"."+2
MOVEI C,45 ;HACK FOR DOT, PERCENT AND DOLLAR.
X6TO5E: IMULI B,50
ADD B,C
SETZ C,
JRST X6TO5A ;LOOP.
;ROUTINE TO LOOK FOR SYMBOL IN INTERNAL TABLE ONLY.
XDEF: MOVE C,INSCNT ;GET COUNT OF INTERNALIZED SYMBOLS.
JUMPE C,CPOPJ ;NONE INTERNAL: LOSE.
CAME A,INSYM-1(C) ;LOOK FOR ONE
SOJG C,.-1
JUMPLE C,CPOPJ ;LOSE. CAN'T FIND IT INSIDE
MOVE B,INVAL-1(C) ;WIN. GOT IT.
JRST CPOPJ1 ;RETURN IT
; SUBROUTINE TO LOOK FOR SYMBOL IN INTERNAL TABLE, IF FAILURE, LOOK IN UPPER.
DEF: PUSHJ P,XDEF ;LOOK INSIDE FOR IT
JRST DEF3 ;NOT INSIDE
JRST CPOPJ1 ;SUCCESS.
DEF3: PUSHJ P,GETDEF ;GET THE DEFINITION FROM THE UPPER.
POPJ P, ;THERE IS NO SUCH BEAST.
AOS C,INSCNT ;COUNT A SYMBOL FOUND
CAILE C,SYMMAX ;SKIP IF OK
JRST DEF4 ;SYMBOL TABLE OVERFLOW
MOVEM A,INSYM-1(C) ;SAVE IT INTERNALLY.
MOVEM B,INVAL-1(C) ;SAVE VALUE
JRST CPOPJ1 ;RETURN HAPPY.
DEF4: OUTSTR [ASCIZ/INTERNAL SYMBOL TABLE OVERFLOW!
/]
SOS INSCNT ;CORRECT THE COUNT.
JRST CPOPJ1 ;RETURN CORRECT VALUE IN B.
SUBTTL SEGMENT MANAGER
COMMENT $
THIS CODE IS USED WHEN SOMEONE DECIDES HE WANTS TO USE
A PARTICULAR UPPER, EITHER THE SYMBOL SEGMENT OR
PHYSICAL CORE, CAN BE SELECTED. IF THE SEGMENT SELECTED
IS NOT THE SAME AS THE SEGMENT THAT WAS IN USE, THE SEGMENTS
ARE SWITCHED.
THE SPACEWAR MODULE USES SETPR2 EXCLUSIVLY. THE USER MODE
PORTION CAN DO WHATEVER IT WANTS.
SEGATT ATTACH SYMBOLS.
SYSATT ATTACH SYSTEM. SET A TO THE APPROPRIATE VALUE.
LAST VALUE OF SETPR2 IS REMEMBERED AS PROREL
ATTOLD USES PROREL TO DO THE SETPR2.
$
SEGATT: SKIPE STHERE ;IS SEGMENT THERE ALREADY?
POPJ P, ;YES. RETURN QUICK
SETOM STHERE ;ANNOUNCE WE HAVE A SEGMENT.
LINKUP ;TRY TO LINKUP
JRST NOLINK ;LINKUP FAILURE.
POPJ P, ;RETURN
ATTOLD: MOVE A,PROREL ;GET OLD VALUE.
SYSATT: SKIPN STHERE ;IS THERE A SEGMENT NOW?
CAME A,PROREL ;NO SEG. IS THIS SAME AS BEFORE?
CAIA ;NEED TO DO SETPR2
POPJ P, ;DON'T NEED TO DO IT.
SKIPE STHERE
DETSEG ;DETACH THE SEGMENT.
SETZM STHERE ;NO SEGMENT THERE.
PUSH P,A
SETPR2 A,
JRST SYSAT1
POP P,PROREL
POPJ P,
SYSAT1: POP P,A
JRST NOSETP
SUBTTL UNDEF - ERROR MESSAGE FOR UNDEFINED SYMBOLS.
UNDEF: PUSH P,A
PUSHJ P,TYSIX
POP P,A
OUTSTR [ASCIZ/ UNDEFINED
/]
JRST CPOPJ1 ;AND SKIP RETURN
TYSIX: MOVE B,A
TYSIX1: SETZ A,
JUMPE B,CPOPJ
LSHC A,6
ADDI A," "
TTCALL 1,A
JRST TYSIX1
SUBTTL BEGIN HERE
BEGIN: RESET
MOVE P,[IOWD PDLEN,PDLIST]
PUSHJ P,GETSYM ;GO GET THE SYSTEM SYMBOLS.
SETOM STHERE ;WE MUST NOW HAVE A SEGMENT.
DEFINE MAKDEF(QQ,RR)
< MOVE A,['QQ']
PUSHJ P,DEF
PUSHJ P,UNDEF ;THIS GUY WILL ALWAYS SKIP RETURN
MOVEM B,RR
>
MOVE A,[SSYMS,,SSYMS+1]
SETZM SSYMS
BLT A,SSYMND ;ZERO OUR SPECIAL CELLS.
MAKDEF JOBNAM,AJOBNA
MAKDEF JBTSTS,AJTSTS
MAKDEF PRJPRG,APRJPR
MAKDEF JBTQ,AJBTQ
MAKDEF JOBQUE,AJQUE
MAKDEF CORTAB,ACORTA
MAKDEF JBTLIN,AJLIN
MAKDEF JBTADR,AJADR
MAKDEF JBTSWP,AJSWP
MAKDEF TTIME,ATTIME
MAKDEF SPWGO,ASPWGO
MAKDEF SP2GO,ASP2GO
MAKDEF JOB,AJOB
MAKDEF FORCE,AFORCE
MAKDEF FIT,AFIT
MAKDEF SHFWAT,ASHFWA
MAKDEF UPTIME,AUPTI
MAKDEF CONFIG,ACONFI
MAKDEF TIME,ATIME
MAKDEF MXQUE,VMXQUE
MAKDEF QNAMS,AQNAMS
MAKDEF THSDAT,ATDATE
MAKDEF JBTST2,AJBST2
DPYCLR ;CLEAR THE DISPLAY
DPYSIZ 2001 ;1 LINE/GLITCH, 4 GLITCHES/SCREEN
DPYPOS -740 ;PUSH PIECE OF PAPER TO BOTTOM OF SCREEN.
MOVEI A,37 ;LOOK FOR SYSTEM JOBREL
PEEK A,
MOVEM A,SYSREL ;LARGEST ADDRESS IN SYSTEM
MOVE B,A
ADDI B,1
LSH B,-12
MOVEM B,CORSIZ
CAILE A,377777 ;128K OR LESS?
MOVEI A,377777 ;NO REDUCE TO 128
TRZ A,1776 ;MASK IRRELEVENT BITS
MOVSI A,(A) ;THIS IS PROTECTION. ZERO RELOCATION
PUSHJ P,SYSATT ;ATTACH TO THE SYSTEM
HRLZ A,AQNAMS
TLO A,400000 ;MAKE ADDRESS IN UPPER.
HRRI A,XQNAM ;PLACE TO STORE.
MOVE B,VMXQUE ;GET THE NUMBER OF QUEUES
CAILE B,20
MOVEI B,20
BLT A,XQNAM(B) ;LOAD THE DATA.
MOVE A,[POINT 36,CLKTAB-1,35];MAKE BYTE POINTER FOR CLOCK REQUESTS
MOVEM A,CLOCK ;SAVE BYTE POINTER.
MOVE A,[RCONFI,,1] ;DO THE CONFIG STUFF
IDPB A,CLOCK
SETZM MAPON ;MAKE SURE WE DON'T THINK WE'RE MAPPING
PUSHJ P,SPWINI ;INITIALIZE SPACEWAR JOB
CMAIN: PUSHJ P,MAIN ;CALL THE TTY MAIN LOOP
MOVEI A,1
SLEEP A,
JRST CMAIN ;LOOP.
SUBTTL MAIN COMMAND SCANNER.
MAIN: TTCALL 5,A ;HAS A LINE BEEN ACTIVATED
POPJ P, ;NO. RETURN AND DO NOTHING
SETZM WHATFL
SETZM UFL
PUSHJ P,GETSXX ;COLLECT SIXBIT TEXT
JRST WHACOM ;ERROR UNRECOGNIZED SIXBIT
MOVEM A,ACTIVE ;SAVE ACTIVATOR CODE.
JUMPE B,MAIN1 ;JUMP IF NO TEXT SEEN BEFORE ACTIVATOR
MOVE A,B ;GET THE SIXBIT TEXT,
MOVEM A,TNAME ;SAVE SIXBIT NAME FOR LATER.
PUSHJ P,DEF ;LOOK FOR A DEFINITION.
JRST UCOM ;UNDEFINED. PUT UP TEXT.
MAIN1: MOVEM B,TCODE ;SAVE TABLE CODE.
MOVE A,ACTIVE ;GET THE ACTIVATOR
ANDI A,177 ;STRIP OFF THE BUCKY BITS
CAIL A,"a"
CAILE A,"z"
CAIA
SUBI A," " ;TURN LOWERCASE INTO UPPER.
MOVSI B,-ATABLN ;GET THE TABLE LENGTH
HLRZ C,ATAB(B) ;GET A CHARACTER FROM TABLE.
CAME A,C ;SAME?
AOBJN B,.-2 ;LOOP
JUMPGE B,WHACOM ;DON'T UNDERSTAND
HRRZ B,ATAB(B) ;GET THE COMMAND DISPATCH
JRST (B) ;AND DISPATCH. COMMAND RETURNS WITH POPJ.
ATAB: "X",,XCOM ;XTEND COMMAND
12,CPOPJ ;NULL COMMAND
"6",,SIXCOM ;DISPLAY IN SIXBIT
"T",,TEXCOM ;TEXT OUTPUT
";",,CELCOM ;DISPLAY ONE CELL ONLY
"/",,CELCOM ;DISPLAY INDIVIDUAL CELL
"U",,OHCOM ;DISPLAY OCTAL HALF WORDS
"D",,DECOM ;DISPLAY DECIMAL
"K",,KILCOM ;KILL A DISPLAY
"O",,R8COM ;RADIX 8
ATABLN←←.-ATAB
CELCOM: POPJ P, ;FOR NOW.
KILCOM: MOVN B,QPTR
JUMPE B,CPOPJ
HRLZ B,B
KILCM1: MOVE A,QSPACE(B)
CAMN A,TNAME
JRST KILCM2
ADD B,[3,,3]
JUMPL B,KILCM1
JRST WHACOM
KILCM2: MOVNI C,3
ADDB C,QPTR
MOVE A,QSPACE(C)
MOVEM A,QSPACE(B)
MOVE A,QSPACE+1(C)
MOVEM A,QSPACE+1(B)
MOVE A,QSPACE+2(C)
MOVEM A,QSPACE+2(B)
POPJ P,
R8COM: MOVEI C,DOCT
JRST COMCON
SIXCOM: MOVEI C,DSIXB
JRST COMCON
TEXCOM: MOVEI C,TEXTO ;TO DO TEXT
JRST COMCON
OHCOM: MOVEI C,DOCTH ;TO DO OCTAL HALF WORDS
JRST COMCON
DECOM: MOVEI C,DECOUT
JRST COMCON
COMCON: MOVE B,QPTR ;GET THE QUEUE POINTER.
CAILE B,QLN-20 ;HAVE WE GOT ENOUGH SPACE?
JRST COMCNE ;NO. ERROR.
MOVE A,TNAME ;GET THE SIXBIT NAME
MOVEM A,QSPACE(B) ;SAVE IT.
CAMN A,['JOBQUE'] ;IS THIS SPECIAL?
MOVEI C,QDISP ;YES. USE SPECIAL OUTPUT
HRRZ A,TCODE ;GET THE CODE.
JUMPE A,WHACOM ;ERROR
TRO A,400000 ;MAKE AN ADDRESS IN THE UPPER.
HRLI A,W ;MAKE AN INDEX FIELD FOR W.
MOVEM A,QSPACE+1(B) ;SAVE. IN QUEUE.
MOVEM C,QSPACE+2(B) ;SAVE THE OUTPUT DRIVER NAME.
ADDI B,3
MOVEM B,QPTR
MOVE A,[DPYTAB,,1]
SKIPN TBLON
IDPB A,CLOCK
SETOM TBLON
POPJ P,
COMCNE: TTCALL 3,[ASCIZ/INTERNAL QUEUE SPACE EXCEEDED.
/]
POPJ P,
WHACOM: SETOM WHATFL
JRST CFLUSH
UCOM: SETOM UFL
CFLUSH: TTCALL 11, ;FLUSH HIS TYPE AHEAD
SETZM XON
POPJ P,
XCOM: SETOM XON ;SAY WERE IN X COMMAND MODE
PUSHJ P,GETSIX ;GET SIXBIT
JRST WHACOM
SETZM XON ;
MOVSI A,-XCTB
CAME B,XCTAB(A)
AOBJN A,.-1
JUMPGE A,WHACOM
JRST @XCTAB2(A) ;DISPATCH TO SERVICE.
XCTAB: 'MAP'
'XMAP'
'EXIT'
'KILL'
XCTB←←.-XCTAB
XCTAB2: MAPGO
MAPKIL
DIENOW
KILQ
DIENOW: SPCWAR 'SSW'
DPYCLR ;FLUSH THE DISPLAY
EXIT ;AND EXIT
KILQ: SETZM QPTR
JRST MAPKIL
SUBTTL GETSIX
GETSXX: SETZ B,
JRST GETSX2 ;FALL INTO REST OF GETSIX
GETSIX: SETZ B,
GETSX1: TTCALL 4,A ;GET A CHARACTER
GETSX2: CAILE A,177 ;IS THIS A CONTROL CHARACTER
JRST CPOPJ1 ;YES. RETURN QUICK.
CAIE A," "
CAIN A,15
JRST GETSX1 ;FLUSH CR AND BLANK
CAIE A,11 ;TAB AND LF ARE DELIMITERS.
CAIN A,12
JRST CPOPJ1 ;RETURN THEM.
CAIE A,"/"
CAIN A,";"
JRST CPOPJ1 ;/ AND ; ARE DELIMS.
CAIG A," " ;MUST BE BIGGER THAN A BLANK
POPJ P, ;ERROR FROM GETSIX
CAIL A,"a"
CAILE A,"z"
CAIA
SUBI A," " ;MAKE UPPER CASE
SUBI A," " ;MAKE SIXBIT
CAILE A,77
POPJ P, ;ERROR
TLNE B,770000
JRST GETSX1 ;COLLECT ONLY 6 CHARACTERS.
LSH B,6
IOR B,A
JRST GETSX1 ;LOOP
SUBTTL PUT UP A TITLE LINE.
CONRAT←←=15*SWPSEC ;ACTIVATION RATE.
RCONFI: MOVE SPDL,DPTR0 ;GET THE PDL FOR THIS BUFFER
PUSHJ P,RCON1 ;MAKE MESSAGES
MOVEM SPDL,DPTR0 ;SAVE THE NEW VALUE OF PDL
MOVE A,[RCONFI,,CONRAT] ;REFRESH IN 15 SECONDS
IDPB A,CLOCK ;MAKE A CLOCK REQUEST.
POPJ P,
YHI←←740
YLO←←-710
XHI←←777
XMLO←←540
XLO←←-777
RCON1: PUSH SPDL,[LVW(XLO,YHI,i,a,3)]
PUSH SPDL,[LVW(XHI,YHI,,a,3)]
PUSH SPDL,[LVW(XHI,YLO,,a,3)]
PUSH SPDL,[LVW(XLO,YLO,,a,3)]
PUSH SPDL,[LVW(XLO,YHI,,a,3)]
PUSH SPDL,[LVW(XLO,710,i,a,1,2)] ;MAKE A VECTOR
PUSH SPDL,[ASCID/Monmo/]
PUSH SPDL,[ASCID/n: /]
SKIPN B,ACONFI ;GET ADDRESS OF CONFIG DATA
JRST RCON3 ;LOSE. WE NEVER FOUND ONE
RCON2: MOVE A,400000(B) ;REACH INTO SYSTEM AND GRAB
TRO A,1
PUSH SPDL,A
TRNE A,376 ;WAS LAST BYTE A ZERO?
AOJA B,RCON2 ;NO. LOOP FOR MORE
RCON3: SKIPN B,AUPTI ;NOW DO THE UPTIME
JRST RCON4 ;LOSE
PUSH SPDL,[ASCID/ Upti/]
PUSH SPDL,[ASCID/me: /]
PUSHJ P,DINI
MOVE A,400000(B) ;GET THE UPTIME
MOVEM A,UPTIM
PUSHJ P,HMTIM ;WRITE IT
MOVEI A,";"
PUSHJ P,DCHR
MOVEI A," "
PUSHJ P,DCHR
SKIPN B,ATTIME
JRST RCON4A
MOVE A,400000(B)
IMULI A,=100
IDIV A,UPTIM
PUSHJ P,DECOUT
MOVEI A,"%"
PUSHJ P,DCHR
PUSHJ P,DFIN
PUSH SPDL,[ASCID/Null /]
JRST RCON4
RCON4A: PUSHJ P,DFIN
RCON4: SKIPN B,ATDATE
JRST RCON5
PUSHJ P,DINI
MOVEI A," "
PUSHJ P,DCHR
MOVE A,400000(B)
PUSHJ P,DDATE
PUSHJ P,DFIN
RCON5: SKIPN B,ATIME
POPJ P,
PUSHJ P,DINI
MOVEI A," "
PUSHJ P,DCHR
MOVE A,400000(B)
PUSHJ P,HMTIM
JRST DFIN
SUBTTL SWPINI & SPWMOD SPACEWAR JOB
SPWINI: MOVSI A,SWTICK+400000 ;GET THE DESIRED TICK RATE
HRRI A,SPWMOD
SKIPE DEBUG
JRST SPWMOD
SPCWGO A,
SETOM SPWACT ;ANNOUNCE THAT SPACEWAR LEVEL IS ACTIVE.
POPJ P,
SPWMOD: SKIPN SPWSUS ;IS THERE A SUSPENSION REQUEST?
JRST SPWMD1 ;NO ONE IS REQUESTING SUSPENSION
SETOM SPWACK ;ACKNOWLEDGE SUSPENSION AND HANG
JRST SWEXIT
CELLTB: AJOB,,XJOB
AFORCE,,XFORCE
AFIT,,XFIT
ASHFWA,,XSHFWA
SWCTL←←.-CELLTB
SPWMD1: SETZM SPWACK ;NO SUSPENSION CURRENTLY
MOVSI B,-SWCTL ;GET LENGTH OF CELL TABLE
SWCLOP: HLRZ C,CELLTB(B) ;GET THE ADDRESS
HRRZ D,CELLTB(B) ;GET PLACE TO STUFF IT
SKIPE A,(C) ;ANY ADDRESS?
MOVE A,400000(A) ;GET DATA
MOVEM A,(D) ;STUFF IT
AOBJN B,SWCLOP ;LOOP
DEFINE DPYINI!(QQ)<
MOVE SPDL,[IOWD DPBLN!QQ,DPYBF!QQ]
PUSH SPDL,ZERO
MOVEM SPDL,DPTR!QQ
>
DPYINI 0
DPYINI 1
DPYINI 2
DPYINI 3
DPYINI 4
DPYINI 5
MOVE P,[IOWD SPDLEN,SPWPDL]
PUSHJ P,CLKP
PUSHJ P,WHAT ;MAKE ERROR/OK DISPLAY.
JRST 3,@[.+1] ;LEAVE IOT MODE.
DEFINE DPYFIN!(QQ)<
HLRE B,DPTR!QQ ;GET -INITIAL VALUE+COUNT
ADDI B,DPBLN!QQ ;ADD INITIAL VALUE
MOVEI A,DPYBF!QQ ;GET ADDRESS OF DATA
HRRZM A,DPYHD!QQ ;SAVE ADDRESS OF DATA
HRRZM B,DPYHD!QQ+1 ;SAVE COUNT
CAILE B,1 ;SKIP IF SMALL COUNT
UPGIOT QQ,DPYHD!QQ ;DO THE DISPLAY
>
DPYFIN 0
DPYFIN 1
DPYFIN 2
DPYFIN 3
DPYFIN 4
DPYFIN 5
SKIPN BODNOW
JRST SWEXIT ;ALL DONE WITH SPACEWAR
SETZM BODNOW ;CLEAR FLAG
MOVEI A,BLINK ;NORMAL CASE DISPLAY
SKIPN BODPOS ;SIGNALLING FOR A PURGE?
MOVEI A,DPZERO ;YES: PUT UP A ZERO WORD PROGRAM
UPGIOT 17,(A)
SWEXIT: SKIPN DEBUG
DISMIS ;ANOTHER SPACEWAR TERMINATES OK.
MOVEI A,0
SLEEP A,
PUSHJ P,MAIN ;DO THE MAIN LOOP
JRST SPWMOD ;LOOP
SWERR: MOVEM P,PATCH
MOVEM A,PATCH+1
MOVEM B,PATCH+2
SETOM SPWSUS
DISMIS ;IN CASE
WHAT: MOVE SPDL,DPTR5 ;GET A PIECE OF GLASS TO USE
PUSH SPDL,[LVW(740,740,i,a,4,4)] ;VECTOR OUT.
SKIPN WHATFL
SKIPE UFL
JRST WHAT1
SKIPN XON ;XTEND MODE?
SKIPA A,[ASCID/OK/] ;NORMAL MODE
MOVE A,[ASCID/XTEND/]
JRST WHAT2
WHAT1: MOVE A,[ASCID/U/]
SKIPE WHATFL
MOVE A,[ASCID/??/]
WHAT2: PUSH SPDL,A
MOVEM SPDL,DPTR5
POPJ P,
SUBTTL PROCESS "CLOCK" REQUESTS
CLKP: HRRZ A,CLOCK ;GET THE POINTER VALUE
CLKP1: CAIGE A,CLKTAB ;ANY LEFT?
POPJ P, ;NONE LEFT. RETURN
SOS B,(A) ;DECREMENT THE COUNT
TRNE B,7777 ;ANY TIME LEFT?
SOJA A,CLKP1 ;YES. LOOK AT ANOTHER.
MOVE C,@CLOCK ;GET LAST GUY IN LIST.
MOVEM C,(A) ;SAVE HERE
SOS CLOCK ;MAKE LIST SHORTER.
PUSH P,A ;SAVE CRITICAL VALUE
HLRZ A,B ;GET DISPATCH ADDRESS
LDB B,[POINT 6,B,23] ;LOAD B WITH PARAMETER
PUSHJ P,(A) ;GO OFF AND DO IT!
POP P,A ;RESTORE A
SOJA A,CLKP1 ;LOOP.
SUBTTL DCHR CHARACTER-BY-CHARACTER DISPLAY
DFIN: MOVN A,TCNT ;HERE TO FINISH. GET COUNT OF SPACE
CAIE A,5 ;IF THERE'S 5 LEFT, NOTHING TO DO
PUSH SPDL,TWORD ;HERE WE STUFF THE LAST WORD MADE.
POPJ P, ;RETURN
DCHR: IDPB A,TBYP ;HERE TO STUFF A CHARACTER
AOSGE TCNT ;TEST COUNT. SKIP IF OVERFLOW.
POPJ P, ;COUNT IS STILL OK
PUSH SPDL,TWORD ;ADD WORD TO DISPLAY LIST AND REINITIALIZE
DINI: MOVEI A,1 ;HERE TO INITIALIZE DISPLAY
MOVEM A,TWORD ;MAKE A TEXT WORD
MOVNI A,5 ;CHARACTER COUNT
MOVEM A,TCNT ;SAVE
MOVE A,[POINT 7,TWORD] ;BYTE POINTER
MOVEM A,TBYP ;SAVE
POPJ P, ;RETURN
SUBTTL HMSTIME HOURS-MINUTES-SECONDS TIME.
HMSTIM: IDIVI A,74
IDIVI A,74 ;SECONDS IN B
PUSH P,B
IDIVI A,74 ;MINUTES IN B
PUSH P,B ;
PUSHJ P,DECOUT ;DECIMAL OUT - HOURS
MOVEI A,":"
PUSHJ P,DCHR
POP P,A ;GET MINUTES
MOVEI B,2 ;DIGIT COUNT IN B
PUSHJ P,DECDIG
MOVEI A,":"
PUSHJ P,DCHR
POP P,A
MOVEI B,2
JRST DECDIG
HMTIM: IDIVI A,74*74 ;FLUSH JIFFIES AND SECONDS
IDIVI A,74 ;MINUTES IN B
PUSH P,B ;SAVE MINUTES
PUSHJ P,DECOUT ;DECIMAL OUT - HOURS
MOVEI A,":"
PUSHJ P,DCHR
POP P,A ;GET MINUTES
MOVEI B,2 ;DIGIT COUNT IN B
JRST DECDIG ;WRITE DECIMAL
DECPAD: MOVEM B,DIGCNT ;SAVE CHARACTER COUNT
MOVEI B," " ;GET THE FILL CHARACTER
MOVEM B,FILCHR ;SAVE IT.
JRST DECCOM
DECOUT: MOVEI B,0
DECDIG: MOVEM B,DIGCNT ;SAVE NUMBER OF DIGITS TO DO
MOVEI B,"0"
MOVEM B,FILCHR ;SAVE THE FILL CHARACTER
DECCOM: IDIVI A,12
HRLM B,(P)
SOS DIGCNT
JUMPE A,.+2
PUSHJ P,DECCOM
SKIPG DIGCNT
JRST DECCM1
DECCM0: MOVE A,FILCHR ;GET THE FILL CHARACTER.
PUSHJ P,DCHR
SOSLE DIGCNT
JRST DECCM0
DECCM1: HLRZ A,(P)
ADDI A,"0"
JRST DCHR
SUBTTL DDATE
DDATE: IDIVI A,=31 ;DAYS IN B
PUSH P,A ;SAVE A
MOVEI A,1(B)
PUSHJ P,DECOUT ;TYPE DAYS
POP P,A
IDIVI A,=12 ;MONTHS IN B
PUSH P,A
PUSHJ P,DFIN
PUSH SPDL,MONTAB(B)
PUSHJ P,DINI
POP P,A
ADDI A,100
JRST DECOUT
MONTAB: ASCID /-Jan-/
ASCID /-Feb-/
ASCID /-Mar-/
ASCID /-Apr-/
ASCID /-May-/
ASCID /-Jun-/
ASCID /-Jul-/
ASCID /-Aug-/
ASCID /-Sep-/
ASCID /-Oct-/
ASCID /-Nov-/
ASCID /-Dec-/
SUBTTL DPYTAB
DPTBRT←←SWPSEC/2 ;2 DISPLAYS/SECOND
DPYTAB: SKIPN TBLON
POPJ P, ;FLUSH.
MOVE A,[DPYTAB,,DPTBRT]
IDPB A,CLOCK
MOVE SPDL,DPTR4
PUSHJ P,DPYTB1
MOVEM SPDL,DPTR4
POPJ P,
DPYTB1: SKIPE QPTR ;ANYTHING IN QUEUE?
JRST DPTB1A ;YES. DO IT.
PUSH SPDL,ZERO ;NO. FLUSH DISPLAY
SETZM TBLON ;NO MORE DISPLAY ACTIVE
POPJ P,
DPTB1A: HRLZ A,AJTSTS ;GET ADDRESS OF JBTSTS TABLE
JUMPE A,CPOPJ ;LOSE BIG
TLO A,400000 ;TURN ON HIGH SEGMENT BIT
HRRI A,XSTS ;PLACE TO PUT IT ALL
BLT A,XSTS+JOBN-1
MOVSI A,-JOBN
SETZ B,
JNA←←40000
MOVSI C,JNA
TDNE C,XSTS(A)
ADDI B,1
AOBJN A,.-2
MOVEM B,NJACT ;SAVE NUMBER OF JOBS ACTIVE.
PUSH SPDL,[LVW(-776,YHI-50,i,a,2,2)]
PUSHJ P,DINI
; DO THE LINE AT THE TOP OF THE SCREEN.
SETZ X, ;START AT THE START
MOVSI A,'JOB'
PUSHJ P,DSIXB ;DISPLAY IN SIXBIT
DPYTB2: MOVE A,QSPACE(X) ;GET THE NAME OF THE THING BEING DISPLAYED
PUSHJ P,DSIXB ;WRITE IT AS 6 CHARACTERS
MOVE A,[ASCII/ /] ;PLUS 2 BLANKS.
PUSHJ P,TEXTO
MOVSI B,-SPDIST ;GET THE NUMBER OF SPECIAL DISPATCHES
DPTB2A: HRRZ C,SPDIS(B) ;
CAME C,QSPACE+2(X) ;LOOK FOR A MATCH
AOBJN B,.-2
JUMPGE B,DPTB2B
HLRZ C,SPDIS(B)
PUSHJ P,(C)
DPTB2B: ADDI X,3
CAMGE X,QPTR
JRST DPYTB2 ;LOOP
SETZ Y, ;COUNT THE NUMBER OF LINES DONE.
MOVSI W,-JOBN ;GET LOOP CONTROL SET.
DPYTB3: MOVE A,XSTS(W) ;GET THE JOB STATUS
TLNN A,JNA ;JOB THERE?
JRST DPYTB4 ;NOPE.
PUSHJ P,DFIN
PUSH SPDL,[LVW(-776,0,i,a,2,2)]
ADDI Y,1
MOVN A,Y
IMULI A,YHI-YLO-40
IDIV A,NJACT ;DIVIDE BY NUMBER OF ACTIVE JOBS.
ADDI A,YHI-40
DPB A,[POINT 11,(SPDL),21]
PUSHJ P,DINI
HRRZ A,W ;YES. GET THE JOB NUMBER.
MOVEI B,3 ;REQUIRE 3 CHARACTERS
PUSHJ P,DECPAD ;WRITE IN DECIMAL WITH 3 CHARACTERS.
MOVE A,[ASCII/ /]
PUSHJ P,TEXTO
SETZ X,
DPTB3A: MOVE A,@QSPACE+1(X) ;GET THE DATA FROM SYSTEM.
PUSHJ P,@QSPACE+2(X) ;DISPATCH
MOVE A,[ASCII/ /]
PUSHJ P,TEXTO
ADDI X,3
CAMGE X,QPTR
JRST DPTB3A
DPYTB4: AOBJN W,DPYTB3 ;DO THE NEXT JOB.
POPJ P,
SPDIS: SDOCTH,,DOCTH ;SPECIAL HEADING ROUTINE,,DATA ROUTINE
SPDIST←←.-SPDIS
SDOCTH: MOVE A,[ASCII/ /]
PUSHJ P,TEXTO
MOVE A,[ASCII/ /]
JRST TEXTO
SUBTTL MAP DISPLAY A CORE MAP
MAPRAT←←SWPSEC/3 ;REFRESH 3 TIMES/SEC
MAP: SETZM MAPON ;TEMPORARILY SET NOT MAPPING
MOVE SPDL,DPTR2 ;GET A BUFFER POINTER
PUSHJ P,MAP1
MOVEM SPDL,DPTR2 ;SAVE BUFFER POINTER
MOVE A,[MAP,,MAPRAT] ;1/5 SECOND BETWEEN ACTIVATIONS
SKIPN MAPOFF ;IF THE MAP MUST DIE, KILL IT HERE
IDPB A,CLOCK
POPJ P,
MAPGO: SKIPE MAPON ;DO WE HAVE A MAP IN PROGRESS?
POPJ P, ;YES. DON'T MAKE ANOTHER.
SETZM MAPTXT
MOVE A,[MAPTXT,,MAPTXT+1]
BLT A,MAPNAM+JOBN-1 ;ZERO A BIG PLACE
SETZM BODPOS ;MAKE SURE THE LITTLE MAN GETS STARTED.
SETZM BODNOW ;SET WHEN WE NEED A BODY
MOVE A,[MAP,,1]
SETZM MAPOFF ;FLUSH ANY PRIOR SUSPENSION
IDPB A,CLOCK
POPJ P, ;USER MODE ROUTINE TO START MAP
MAPKIL: SETOM MAPOFF ;SET FLAG
MOVE A,[MKIL2,,3]
IDPB A,CLOCK
POPJ P,
MKIL2: SETZM MAPOFF
POPJ P,
MAP1: SKIPN MAPOFF ;ARE WE KILLING THE MAP NOW?
JRST MAP1A ;NO. DO THE MAP AGAIN.
PUSH SPDL,ZERO ;KILL THE MAP. STUFF A ZERO DOWN THE HOLE
SETZM BODPOS ;ZERO POSITION OF THE BODY.
SETOM BODNOW
POPJ P, ;AND RETURN
MAP1A: SETOM MAPON ;TELL THE WORLD WE ARE STILL MAKING MAPS.
PUSH SPDL,[LVW(XMLO,YHI,i,a)]
PUSH SPDL,[LVW(XMLO,YLO,,a)]
HRLZ A,ACORTA
JUMPE A,CPOPJ
TLO A,400000
HRRI A,XCORTB
BLT A,XCORTB+77
HRLZ A,AJOBNA
JUMPE A,CPOPJ
TLO A,400000
HRRI A,XNAME
BLT A,XNAME+JOBN-1
HRLZ A,APRJPR
JUMPE A,CPOPJ
TLO A,400000
HRRI A,XPPN
BLT A,XPPN+JOBN-1
HRLZ A,AJBST2
JUMPE A,CPOPJ
TLO A,400000
HRRI A,XJBST2
BLT A,XJBST2+JOBN-1
HRLZ A,AJTSTS
JUMPE A,CPOPJ
TLO A,400000
HRRI A,XSTS
BLT A,XSTS+JOBN-1
MOVE W,[POINT 9,XCORTB]
SETZM LOLOC
MOVEI Z,101 ;INITIALLY, WE EXPECT THE SYSTEM
MOVEM Z,THSJOB
SETZB Z,HILOC ;WHERE LAST LINE WAS DRAWN
SETZM HOLSEN ;SET THIS WHEN WE SEE A HOLE
SETZM MANLOC ;SET THIS WHEN YOU LOCATE THE MAN
MAP2: ILDB Y,W ;GET A BYTE
CAMN Y,THSJOB ;ARE WE SAME USER'S AREA?
AOJA Z,MAP2 ;COUNT ANOTHER K INSIDE THIS USER
MOVEM Z,HILOC ;SAVE LAST LOCATION USED
MOVE A,THSJOB ;GET ARGUMENT
MOVEM Y,THSJOB ;AND SAVE NEW ARGUMENT.
JUMPN A,.+2
SETOM HOLSEN ;REMEMBER THAT WE SAW A HOLE.
PUSHJ P,MDRAW ;DRAW A MAP
MOVE Z,HILOC ;THIS LAST GUY'S HIGEST
MOVEM Z,LOLOC ;IS NEXT GUY'S LOWEST
MOVE A,THSJOB
CAIE A,105 ;IS THIS BEGINNING OF FREE STG
AOJA Z,MAP2 ;INCREMENT AND LOOP.
MOVE Z,CORSIZ
MOVEM Z,HILOC
JRST MDRAW ;GO OFF AND DO THE F.S. THING
SUBTTL THE LITTLE MAN INSIDE?
PUTPOS: CAMN B,BODPOS ;DON'T CHANGE IT IF ITS RIGHT ALREADY
POPJ P,
MOVEM B,BODPOS ;TO HIS FEET
GOBODY: SETOM BODNOW ;SET THIS TO MAKE THE BODY START
POPJ P,
BLINK: BDYTAB ;POINTER TO DATA
0,,BUFLEN ;WORD COUNT
BDYTAB: 1 ;NO-OP
XWD BPOS,74 ;WHERE WE WERE LAST TIME.
<BYTE(8)0,0,200>+12
BYTE(11)200,0(3)0,0(2)0,2(4)6 ;20 TO RIGHT OF THERE
BYTE(11)20,0(3)0,0(2)0,2(4)6 ;20 TO RIGHT OF THERE
<BYTE(8)0,0,40>+12 ;EDGE OVERFLOW?
XWD BLEAV,20 ;NO
BYTE(11)0,0(3)0,0(2)1,2(4)6 ;RESET TO CENTER
<BYTE(8)240,200,0>+12 ;TOGGLE CTRL BIT. TURN OFF EO
BLEAV: XWD BPOS,64 ;SAVE WHERE WE ARE NOW
BODPOS: BYTE(11)1400,1400(3)0,0(2)1,2(4)6 ;ABSOLUTE POSITION
<BYTE(8)0,0,200>+12 ;CONTROL BIT ON?
BYTE(11)0,20(3)0,0(2)0,2(4)6
XWD .+2,20 ;SKIP SAVED WORD
BPOS: 1
DEFINE FOO(X,Y,III)
{
II←←0
IFIDN {III}{I}{II←2}
BYTE(11)<X-XX>,<Y-YY>(3)0,0(2)0,II(4)6
XX←X
YY←Y
}
XX←0
YY←-64
FOO 777776,000100,I
FOO 777774,000100
FOO 777770,000076
FOO 777764,000072
FOO 777762,000066
FOO 777762,000062
FOO 777764,000056
FOO 777770,000052
FOO 777772,000044
FOO 777770,000040
FOO 777764,000034
FOO 777750,000034
FOO 777742,000040
FOO 777740,000054
FOO 777746,000064
FOO 777750,000064
FOO 777754,000070
FOO 777754,000072
FOO 777752,000072
FOO 777752,000074
FOO 777750,000074
FOO 777750,000076
FOO 777746,000076
FOO 777742,000072
FOO 777742,000070
FOO 777732,000056
FOO 777734,000034
FOO 777744,000026
FOO 777752,000024
FOO 777762,000000
FOO 777750,777750
FOO 777754,777720
FOO 777750,777716
FOO 777742,777716
FOO 777742,777714
FOO 777762,777714
FOO 777762,777722
FOO 777756,777750
FOO 777776,777770
FOO 777776,000100,I
FOO 000000,000100
FOO 000004,000076
FOO 000010,000072
FOO 000012,000066
FOO 000012,000062
FOO 000010,000056
FOO 000004,000052
FOO 000002,000044
FOO 000004,000040
FOO 000010,000034
FOO 000024,000034
FOO 000032,000040
FOO 000034,000054
FOO 000026,000064
FOO 000024,000064
FOO 000020,000070
FOO 000020,000072
FOO 000022,000072
FOO 000022,000074
FOO 000024,000074
FOO 000024,000076
FOO 000026,000076
FOO 000032,000072
FOO 000032,000070
FOO 000042,000056
FOO 000040,000034
FOO 000030,000026
FOO 000022,000024
FOO 000012,000000
FOO 000024,777750
FOO 000020,777720
FOO 000024,777716
FOO 000032,777716
FOO 000032,777714
FOO 000012,777714
FOO 000012,777722
FOO 000016,777750
FOO 777776,777770
FOO 777764,000066,I
FOO 777766,000072
FOO 777772,000076
FOO 777774,000076
FOO 777774,000074,I
FOO 777772,000074
FOO 777770,000072
FOO 777770,000070
FOO 777772,000070,I
FOO 777774,000074
FOO 777776,000076,I
FOO 000000,000076
FOO 000004,000072
FOO 000006,000066
FOO 000002,000070,I
FOO 000002,000072
FOO 000000,000074
FOO 777776,000074
FOO 000000,000070
FOO 777776,000070,I
FOO 777774,000076
FOO 777772,000066,I
FOO 777770,000066
FOO 777766,000064
FOO 777770,000062
FOO 777772,000062
FOO 777774,000064
FOO 777772,000066
FOO 000002,000066,I
FOO 000004,000066
FOO 000006,000064
FOO 000004,000062
FOO 000002,000062
FOO 000000,000064
FOO 000002,000066
FOO 777776,000062,I
FOO 777774,000060
FOO 000000,000060
FOO 777776,000062
FOO 777770,000056,I
FOO 777774,000054
FOO 000000,000054
FOO 000004,000056
FOO 777762,000026,I
FOO 000014,000026
FOO 000004,000006
FOO 777770,000006
FOO 777762,000026
FOO 777762,000002,I
BYTE(11)0,0(3)0,1(2)0,2(4)6
ASCID/S/
0
BUFLEN←←.-BLINK-2
SUBTTL MDRAW DRAW THE MAP
COMMENT $
THIS ROUTINE WILL DRAW A LINE ON THE MAP TO DELIMIT THIS
AREA OF CORE, AND PUT UP A LEGEND IN THE RESULTING BOX.
PARAMETERS ARE:
A JOB NUMBER
0 = HOLE
101 = SYSTEM
105 = FREE STORAGE
HILOC HIGHEST ABSOLUTE ADDRESS IN USE
LOLOC LOWEST ABSOLUTE ADDRESS ON USE
$
MBYP: POINT 11,(SPDL),21 ;POINTER TO SET Y FIELD IN LVW AT END OF BUFFER
MDRAW: MOVEM A,THJDR ;SAVE JOB NUMBER FOR A WHILE.
MOVE B,HILOC ;GET THE LOCATION FOR LINE
HRL B,LOLOC ;GET LOLOC TOO.
CAMN B,MPHILO(A) ;SAME AS BEFORE?
JRST MDRW0 ;YES.
MOVEM B,MPHILO(A) ;NO. SAVE THIS NOW.
MOVE B,HILOC ;GET THE HILOC
IMULI B,YHI-YLO ;TIMES THE RESOLUTION HEIGHT
IDIV B,CORSIZ ;DIVIDE TO MAKE A FRACTION
ADDI B,YLO
HRRM B,MPYLOC(A) ;SAVE IT.
MOVE B,HILOC
ADD B,LOLOC
IMULI B,<YHI-YLO>/2
IDIV B,CORSIZ
ADDI B,YLO-10
HRLM B,MPYLOC(A)
MDRW0: CAIL A,105 ;NO TOP BAR FOR FREE STORAGE
JRST MDRAW0 ;SO SKIP THIS BIT
PUSH SPDL,[LVW(XMLO,0,i,a,2,1)] ;GET THE LVW
HRRZ B,MPYLOC(A) ;GET DATA
DPB B,MBYP ;STUFF IN A NEW Y FIELD
PUSH SPDL,[LVW(XHI,0,,a)]
DPB B,MBYP
JUMPE A,CPOPJ ;ALL DONE IF THERE'S NO JOB
SKIPE HOLSEN ;ARE WE ABOVE A HOLE
SKIPE MANLOC ;HAS MAN BEEN DONE
JRST MDRAW0 ;NO HOLE, OR NOT FIRST ABOVE FIRST HOLE
SETOM MANLOC
ANDI B,3777 ;LOOK AT ONLY 11 BITS, PLEASE.
LSH B,=36-=22
IOR B,[LVW(<<XMLO+XHI>/2>,0,i,a,2,1)] ;GET A POINTER
PUSHJ P,PUTPOS ;MAKE THE LITTLE MAN APPEAR
MDRAW0: HLRZ B,MPYLOC(A) ;GET LOCATION FOR THE TEXT
PUSH SPDL,[LVW(XMLO,0,i,a,2,1)]
DPB B,MBYP
CAIGE A,JOBN ;IS SMALLER THAN A BREADBOX?
JRST MDRAW1 ;SMALL ENOUGH TO BE A JOB.
CAIE A,101 ;IS THIS THE MONITOR?
JRST MDRW01 ;NO
PUSH SPDL,[ASCID/ Mon/]
SKIPE XJOB
POPJ P, ;DONE FOR NOW
PUSH SPDL,[LVW(0,0,i,,7,1)]
PUSH SPDL,[ASCID/ /]
PUSH SPDL,[ASCID/ /]
PUSH SPDL,[ASCID/ /]
PUSH SPDL,[ASCID/ ⊗/]
POPJ P,
MDRW01: CAIE A,105
POPJ P,
PUSH SPDL,[ASCID/ F.S./]
SKIPN B,MANLOC ;HAS THE MAN BEEN LOCATED?
PUSHJ P,PUTPOS ;NO. A ZERO WILL KILL IT
POPJ P,
MDRAW1: MOVE B,THJDR ;GET THE JOB NUMBER
MOVE C,XNAME(B) ;GET NEW NAME
MOVE D,XPPN(B) ;GET NEW PPN
CAMN C,MAPNAM(B) ;SAME AS MAP?
CAME C,MAPPPN(B) ;SAME AS MAP?
JRST MDRAW2 ;DIFFERENT. MUST RECOMPUTE
IMULI B,4 ;MULTIPLY BY THE NUMBER OF WORDS IN TEXT
PUSH SPDL,MAPTXT(B) ;STUFF TEXT
PUSH SPDL,MAPTXT+1(B) ;STUFF TEXT
PUSH SPDL,MAPTXT+2(B) ;STUFF TEXT
PUSH SPDL,MAPTXT+3(B) ;STUFF TEXT
JRST MDRAW3 ;LOOK FOR SPACEWAR AND THIS JOB BEING RUN
MDRAW2: MOVEM C,MAPNAM(B) ;SAVE NEW VALUES OF NAME
MOVEM D,MAPPPN(B) ;AND PPN.
PUSHJ P,DINI
MOVE A,THJDR
MOVEI B,2
PUSHJ P,DECDIG ;WRITE IN DECIMAL AND PAD IT.
MOVE B,THJDR
MOVEI A," "
PUSHJ P,DCHR
MOVEI A," "
PUSHJ P,DCHR ;A SPACE
MOVE A,THJDR
MOVE A,XPPN(A)
PUSHJ P,DSIXB
MOVEI A," "
PUSHJ P,DCHR
MOVE A,THJDR
MOVE A,XNAME(A)
PUSHJ P,DSIXB
PUSHJ P,DFIN
MOVE A,[ASCID/ /] ;PICKUP 5 BLANKS
DPB A,[POINT 22,(SPDL),35] ;STUFF 3 BLANKS AND DISPLAY COMMAND BIT
MOVE A,THJDR ;GET THE JOB NUMBER
IMULI A,4 ;TIMES NUMBER OF WORDS TO STORE AWAY
MOVE B,-3(SPDL)
MOVEM B,MAPTXT(A) ;STUFF
MOVE B,-2(SPDL)
MOVEM B,MAPTXT+1(A)
MOVE B,-1(SPDL)
MOVEM B,MAPTXT+2(A)
MOVE B,(SPDL)
MOVEM B,MAPTXT+3(A) ;SAVE ALL THE TEXT.
MDRAW3: MOVE A,THJDR
SKIPE B,XJBST2(A) ;GET SPACEWAR STATUS
TLNE B,40000 ;CHECK SPW SUSPENSION BIT
JRST MDRAW4 ;GUY IS NOT IN SPW.
MOVEI B,"↔" ;SET SPECIAL FLAG
DPB B,[POINT 7,(SPDL),34]
MDRAW4: MOVE B,XSTS(A)
TRNE B,100000 ;TEST JLOCK BIT IN JBTSTS
PUSH SPDL,[ASCID/LOCK/]
CAME A,XJOB
JRST MDRAW5
PUSH SPDL,[LVW(0,0,i,,7,1)]
PUSH SPDL,[ASCID/ ⊗ /]
MDRAW5: CAMN A,AFORCE
PUSH SPDL,[ASCID/FORCE/]
CAME A,ASHFWA
POPJ P,
PUSH SPDL,[ASCID/SHFWA/]
PUSH SPDL,[ASCID/T/]
POPJ P,
SUBTTL DSIXB SIXBIT OUTPUT ROUTINE
DSIXB: MOVE B,A
PUSH P,C
MOVEI C,6
DSIXB1: SETZ A,
LSHC A,6
ADDI A," "
PUSHJ P,DCHR
SOJG C,DSIXB1
POP P,C
POPJ P,
DOCTH: PUSH P,C
PUSH P,A ;CALL HERE FOR OCTAL HALF WORDS.
HLRZ A,A
MOVEI C,=12 ;WE SHALL PUT OUT 14. CHARACTERS
PUSHJ P,DOCTC ;PRINT OCTAL, NO SMARTS
MOVEI A,","
PUSHJ P,DCHR
MOVEI A,","
PUSHJ P,DCHR
POP P,A
HRRZ A,A
PUSHJ P,DOCTC ;PRINT SECOND VALUE AND RETURN
DOCTH1: SOJL C,DOCTH2
MOVEI A," "
PUSHJ P,DCHR
JRST DOCTH1
DOCTH2: POP P,C
POPJ P,
DOCTC: SETZ B,
LSHC A,-3
ROT B,3
SUBI C,1
HRLM B,(P)
JUMPE A,.+2
PUSHJ P,DOCTC
HLRZ A,(P)
ADDI A,"0"
JRST DCHR
SPOCT: TLC A,-1
TLCE A,-1
JRST DOCT ;DO NORMAL THING
MOVE B,A
MOVEI A,"-"
PUSHJ P,DCHR
MOVN A,B
DOCT: SETZ B, ;CALL HERE FOR NORMAL OCTAL PRINTER.
LSHC A,-3
ROT B,3
JUMPE A,DOCT3
HRLM B,(P)
PUSHJ P,DOCT
HLRZ B,(P)
DOCT3: MOVEI A,"0"(B)
JRST DCHR
TEXT5: MOVE B,A
TRO B,1
JRST TEXTO1
TEXTO: MOVE B,A ;SAVE CHARACTERS IN B.
TRZ B,1 ;MAKE SURE WE HAVE ASCII TEXT.
TEXTO1: JUMPE B,CPOPJ
SETZ A,
LSHC A,7
PUSHJ P,DCHR
CAME B,[400000,,0]
JRST TEXTO1
POPJ P,
QDISP: MOVM A,A ;GET THE POSITIVE QUEUE NUMBER.
CAMLE A,VMXQUE ;BIGGER THAN MAX QUEUE?
JRST DOCT ;DISPLAY IN OCTAL
MOVE A,XQNAM(A)
PUSHJ P,TEXTO ;OUTPUT AS TEXT.
MOVEI A," "
JRST DCHR ;OUTPUT A SIXTH CHARACTER.
END BEGIN